﻿import mx.utils.Delegate;
class cn.eminia.AS2.M2 {
	static var scale = 1;
	static var state = 0;
	var ctrl;
	var vars;
	static var chixu = 0;
	function M2(scope, vars:Object) {
		//
		this.vars = vars;
		var lis = new Object();
		lis.ss = this;
		lis.onMouseWheel = function(delta:Number) {
			if (state == 1) {
				Delegate.create(scope, vars.onRoll)({vv:delta*scale});
				chixu = 1;
			}
			if (state == 0) {
				this.ss.ctrl = new cn.eminia.AS2.Ctrl(this.ss, 'M2', function () {
					if (!chixu) {
						Delegate.create(scope, vars.onStop)();
						ctrl.dispose();
						state = 0;
					}
					chixu = 0;
				});
				state = 1;
				Delegate.create(scope, vars.onStt)({vv:delta*scale});
				Delegate.create(scope, vars.onRoll)({vv:delta*scale});
				chixu = 1;
			}
		};
		Mouse.addListener(lis);
	}
}
